package org.example.product.entity;

import java.io.Serializable;

import jakarta.validation.constraints.*;
import lombok.Data;
import org.example.core.valid.annontation.ListValue;
import org.example.core.valid.group.AddGroup;
import org.example.core.valid.group.UpdateGroup;
import org.hibernate.validator.constraints.URL;

/**
 * @author 小杰_cc
 * @version 1.0
 */
@Data
public class CategoryEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 分类id
	 */
	@NotNull(message = "修改时必须指定id",groups = {UpdateGroup.class})
	@Null(message = "添加时不能指定id",groups = {AddGroup.class})
	private Long id;
	/**
	 * 分类名称
	 */
	@NotBlank(message = "分类名不能为空",groups = {UpdateGroup.class, AddGroup.class})
	private String name;
	/**
	 * 分类父id
	 */
	@NotNull(message = "父分类id不能为空",groups = {UpdateGroup.class, AddGroup.class})
	private Long pid;
	/**
	 * 层级
	 */
	@NotNull(message = "层级字段不能为空",groups = {AddGroup.class, UpdateGroup.class})
	@Min(value = 1, message = "层级必须是一个大于0的数",groups = {AddGroup.class, UpdateGroup.class})
	private Integer level;
	/**
	 * 是否在导航栏显示(0-显示,1-不显示)
	 */
	@NotNull(message = "请确认是否要在导航栏显示",groups = {AddGroup.class, UpdateGroup.class})
	@ListValue(value = {0,1},groups = {AddGroup.class, UpdateGroup.class})
	private Integer visible;
	/**
	 * 排序
	 */
	@NotNull(message = "排序字段不能为空",groups = {AddGroup.class, UpdateGroup.class})
	@Min(value = 0,message = "排序字段必须是一个大于等于0的数",groups = {AddGroup.class, UpdateGroup.class})
	private Integer sort;
	/**
	 * 图标地址
	 */
	@URL(message = "分类图标必须是一个URL地址",groups = {AddGroup.class, UpdateGroup.class})
	private String icon;
	/**
	 * 是否删除(0-未删除,1-删除)
	 */
	private Integer isDeleted;

}
